<!DOCTYPE html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
    <head>
    <meta charset="UTF-8">
    <title>添加配件</title>
	<script src="../js/jquery.min.js"></script>
    <script src="../js/jquery.easyui.min.js"></script>
    <script src="../js/easyui-lang-zh_CN.js"></script>
    <link rel="stylesheet" href="../themes/icon.css">
    <link rel="stylesheet" href="../themes/default/easyui.css">
    <link rel="stylesheet" href="../css/wu.css">
	<script>
        var  selectIndex = -1;
		var path=$("#path").val();  
        function hideTable(){
            $("#searchdiv").toggle();
        }
        
		$(function() {
			$("#productList").datagrid({
				url : '/kxmanage/sellorderbill/findallpart',
				pageNumber : 1,
				pageSize : 5,
				pageList : [ 5, 10 ],
				pagination : true,
				checkOnSelect : true,
				columns : [ [ {
					field : 'ck',
					checkbox : true
				}, {
					field : 'code',
					title : '配件单号',
					width : 140
				}, {
					field : 'partName',
					title : '配件名称',
					width : 200
				}, {
					field : 'partTypeName',
					title : '配件类别',
					width : 100
				}, {
					field : 'partBrand',
					title : '配件品牌',
					width : 70
				}, {
					field : 'partNo',
					title : '配件型号',
					width : 80
				}, {
					field : 'sellPrice',
					title : '销售单价',
					width : 100,
					formatter : function(value, row, index) {
						return "￥" + row.sellPrice;
					}
				}, {
					field : 'memo',
					title : '备注',
					width : 230
				} ] ],
				toolbar : '#wu_toolbar'
			});
			$("#search_btn").click(function() {
				var form = $("#form2");
				$("#productList").datagrid('load', serializeForm(form));
			});

			$('#partTypeId').combobox({
				url : '/kxmanage/sellorderbill/findallpartname',
				valueField : 'id',
				textField : 'typeName'
			});

		});

		//将表单序列化
		function serializeForm(form) {
			var obj = {};
			$.each(form.serializeArray(),
					function(index) {
						if (obj[this['name']]) {
							obj[this['name']] = obj[this['name']] + ','
									+ this['value'];
						} else {
							obj[this['name']] = this['value'];
						}
					});
			return obj;
		}
		
		function addPart(){
          var row = $('#productList').datagrid('getSelections');
          if(row!=null&&row!=''){
             parent.addPart(row);
          }else{
            alert("请您选择配件！")
          }
        }
        
        function closePart(){
          parent.closePart();
        }
	</script>
  </head>
  
  <body>
    <div id="wu_toolbar">
    <input type="hidden" id="path" value="${pageContext.request.contextPath}"/>
    <div id="searchdiv" style="display: block;width: 100%;">
        <form name="form2" id="form2"> 
            <table width="100%" border="0" cellspacing="0" style="background-color:#c9dfff;" >
                <tbody><tr>
                    <td width="100"><b>检索条件:</b></td>
                    <td width="70" align="right">配件品牌:</td>
                    <td width="90" align="left"><input name="partBrand" class="easyui-textbox" type="text" id="findName" value="" maxlength="70" style="width:120px;height:30px"></td>
                    <td width="70" align="right">配件型号:</td>
                    <td width="90" align="left"><input name="partNo" class="easyui-textbox" type="text" id="findCode" value="" maxlength="70" style="width:120px;height:30px"></td>
                    <td width="100" align="right">配件名称:</td>
                    <td width="90" align="left"><input name="partName" class="easyui-textbox" type="text" id="findCode" value="" maxlength="70" style="width:120px;height:30px"></td>
                     <td width="70" align="right">类别:</td>
                    <td width="100" align="left">
                    <select name="partTypeId" id="partTypeId" class="easyui-combobox"  style="width:120px;height:30px" panelHeight="150px">
                    
                    </select> 
                    </td>
                    <td width="72">
                        <a id="search_btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'">搜索</a>
                    </td>
                    <td width="72">
                        <a id="reset_btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-refresh'">重置</a>
                    </td>
                    <td width="0"></td>
                </tr>
                </tbody>
            </table>
            <input type="hidden" id="menuCode" value="100001001">
        </form>
    </div>
</div>
<div id="productList" class="easyui-datagrid">

</div>

<div id="btnList" style="text-align: right;margin-top: 15px;">
	<a href="javascript:addPart()" class="easyui-linkbutton" style="margin-right: 10px;">添加配件</a>
		<a href="javascript:closePart()" class="easyui-linkbutton">退出</a>
</div>
  </body>
</html>
